home *** CD-ROM | disk | FTP | other *** search
/ NBC Slam Jams! / NBC Slam Jams!.iso / xtras / media_la / fx_set_1.fxm / 00024_Script_Tracking Object < prev    next >
Text File  |  1998-01-20  |  12KB  |  409 lines

  1. -- This is the main object that contains general information about the selected member
  2.  
  3. -- Interface Elements (start with "ie")
  4. property ieUpdateButton, ieFXtextlist
  5.  
  6. -- User selection properties
  7. property pSelectedList -- list of all selected members in active cast
  8. property pSelected -- the first or only selection
  9. property pSelectedMember, pSelectedCast -- member name and cast name of selection
  10. property pOriginalEffects, pNewEffects -- Alphamania effect arguments
  11. property pDrawMethod, pOriginalDrawMethod -- The alphamania property of that member
  12.  
  13. -- Source member properties
  14. property pSource, pSourceMember, pSourceCast, pSourcePosition
  15. property pOriginalSource, pOriginalSourcePosition
  16. property pAlphaOnly, pRelToSprite, pOriginalRelToSprite
  17.  
  18. -- Universal properties
  19. property pEffectsList, pAllEffectsList
  20.  
  21. -- Misc properties
  22. property pUpdateStage, void
  23.  
  24.  
  25. on new me
  26.   global fxDisplayMember
  27.   
  28.   set pSelected = VOID
  29.   set pSource = VOID
  30.   
  31.   
  32.   set pAllEffectsList = GetListOfAllEffects(fxDisplayMember)
  33.   if getPos(pAllEffectsList,#nullfx) then deleteAt(pAllEffectsList,getPos(pAllEffectsList,#nullfx))
  34.   
  35.   getMemberNameAndCast(me)
  36.   
  37.   if count(pSelectedList) > 1 then
  38.     alert "You have selected more than one AlphaMania member. Changes will affect all members, replacing any previous settings."
  39.   end if
  40.   
  41.   getMemberEffects(me)
  42.   
  43.   if validMember(me) then
  44.     getSourceNameAndCast(me)
  45.   end if
  46.   
  47.   updateFXtextlist(me)
  48.   
  49.   
  50.   -- Update Stage CheckBox
  51.   set pUpdateStage = not voidP(pSelected)
  52.   set ieUpdateButton = new(script "CheckBox Button", [#sprite: 7, #cur: pUpdateStage, #active: TRUE, #callback: me])
  53.   
  54.   return(me)
  55. end
  56.  
  57. on removeFromList me
  58.   global fxCurObj, fxDisplayMember
  59.   if not objectP(ieFXtextlist) then exit
  60.   put the pCurActive of ieFXtextlist into i
  61.   if i < 1 or i > count(the pElementList of ieFXtextlist) then exit
  62.   set SelectedEffect = getAt(the pElementList of ieFXtextlist, i)
  63.   if findPos(GetEffectList(fxDisplayMember,SelectedEffect),SelectedEffect) > 0 then
  64.     RemoveEffect(fxDisplayMember,SelectedEffect)
  65.     clearTests(me)
  66.   end if
  67.   if not voidP(getAProp(pNewEffects,SelectedEffect)) then deleteProp(pNewEffects,SelectedEffect)
  68.   updateFXtextlist(me)
  69.   if objectP(fxCurObj) then
  70.     if the pEffect of fxCurObj = SelectedEffect then
  71.       Settings
  72.     end if
  73.   end if
  74. end
  75.  
  76. on updateFXtextlist me ,newObj
  77.   put [] into list
  78.   if listp(pNewEffects) then
  79.     repeat with i = 1 to count(pNewEffects)
  80.       add list, getPropAt(pNewEffects,i)
  81.     end repeat
  82.   end if
  83.   
  84.   if objectP(newObj) then set cur = the pEffect of newObj
  85.   else set cur = VOID
  86.   
  87.   set ieFXtextlist = new(script "Text List", [#list: list, #textField: "FXlist", #textSprite: 10, #cur: cur])
  88. end
  89.  
  90. on getFXList me
  91.   if voidP(pSelected) then
  92.     set pEffectsList =  []
  93.     exit
  94.   end if
  95.   tell the stage to preLoad member pSelected
  96.   tell the stage to set pEffectsList = getEffectList(pSelected)
  97.   repeat with i = count(pEffectsList) down to 1
  98.     if getAt(pEffectsList,i) = #nullfx then deleteAt(pEffectsList,i)
  99.   end repeat
  100. end
  101.  
  102. on goToEffect me, effect
  103.   global fxDisplayMember
  104.   put GetFXMovie(fxDisplayMember, effect) into mov 
  105.   put GetFXPage(fxDisplayMember, effect) into page
  106.   releasePuppets(8,48)
  107.   resetDisplay
  108.   
  109.   put 0 into i
  110.   put the fileName of the activeWindow into pn
  111.   if pn <> "" then
  112.     if the platform contains "Mac" then set the itemDelimiter = ":"
  113.     else set the itemDelimiter = "\"
  114.     set pn = item 1 to (the number of items of pn - 1) of pn
  115.     repeat while TRUE
  116.       put i+1 into i
  117.       set file = getNthFileNameinFolder(pn, i)
  118.       if file = "" then
  119.         alert mov&&"not found."
  120.         exit
  121.       end if
  122.       if file = mov then exit repeat
  123.       if file = (mov&".dir") then exit repeat
  124.     end repeat
  125.     
  126.     go to frame page of movie mov
  127.   else
  128.     go to frame page -- must be running as the stage
  129.   end if
  130.   put "" into text
  131.   if the number of member (string(effect)&&"Help Text") > 0 then
  132.     put field (string(effect)&&"Help Text") after text
  133.   end if
  134.   set fxDisplayMember = the member of sprite 23
  135.   preload fxDisplayMember
  136.   put DescribeEffect(fxDisplayMember, effect) after text
  137.   put text into field "Help Text"
  138.   refresh(ieUpdateButton)
  139. end
  140.  
  141. on getAllSelectedMembers me
  142.   set pSelecteList = []
  143.   tell the stage
  144.     if the activeCastLib > 10000 then return []
  145.     set pSelectedCast = the name of castLib the activeCastLib
  146.     set selectedMemberList = the selection of castLib the activeCastLib
  147.     repeat with x = 1 to count(selectedMemberList)
  148.       set smallList = getAt(selectedMemberList, x)
  149.       repeat with y = getAt(smallList, 1) to getAt(smallList, 2)
  150.         if the type of member y of castLib pSelectedCast = #alpha then
  151.           set pSelectedMember = the name of member y of castLib pSelectedCast
  152.           set pSelected = (member y of castLib pSelectedCast)
  153.           return pSelected
  154.         end if
  155.       end repeat
  156.     end repeat
  157.   end tell
  158.   return VOID
  159. end
  160.  
  161.  
  162. on getMemberNameAndCast me
  163.   set pSelectedList = [] -- list of all selections
  164.   set pSelected = VOID -- the first (or only) selection
  165.   set pSelectedMember = ""
  166.   set pSelectedCast = ""
  167.   
  168.   tell the stage
  169.     if the activeCastLib > 10000 then exit
  170.     set pSelectedCast = the name of castLib the activeCastLib
  171.     set selectedMemberList = the selection of castLib the activeCastLib
  172.     repeat with x = 1 to count(selectedMemberList)
  173.       set smallList = getAt(selectedMemberList, x)
  174.       repeat with y = getAt(smallList, 1) to getAt(smallList, 2)
  175.         if the type of member y of castLib pSelectedCast = #alpha then
  176.           add pSelectedList, (member y of castLib pSelectedCast)
  177.           if voidP(pSelected) then -- if the first selected member
  178.             set pSelectedMember = the name of member y of castLib pSelectedCast
  179.             set pSelected = (member y of castLib pSelectedCast)
  180.           end if
  181.         end if
  182.       end repeat
  183.     end repeat
  184.   end tell
  185. end
  186.  
  187. on getMemberEffects me
  188.   if voidP(pSelected) then
  189.     set list = [:]
  190.   else
  191.     tell the stage
  192.       preload member pSelected
  193.       put GetEffectList(pSelected) into list
  194.       repeat with i = 1 to count(list)
  195.         put getPropAt(list,i) into effect
  196.         put GetEffectArgs(pSelected,effect) into effectlist
  197.         setAt(list,i,effectlist)
  198.       end repeat
  199.     end tell
  200.     
  201.     if findPos(list,#nullfx) then deleteAt(list,findPos(list,#nullfx))
  202.   end if
  203.   
  204.   set pOriginalEffects = list
  205.   set pNewEffects = list
  206.   
  207.   if not voidP(pSelected) then
  208.     tell the stage
  209.       set pDrawMethod = the drawMethod of pSelected
  210.       set pOriginalDrawMethod = the drawMethod of pSelected
  211.     end tell
  212.   end if
  213. end
  214.  
  215. on setDrawMethod me, method
  216.   set pDrawMethod = method
  217.   if not voidP(pSelected) then
  218.     tell the stage to set the drawMethod of pSelected = pDrawMethod
  219.   end if
  220. end
  221.  
  222. on setRelToSprite me, active
  223.   set pRelToSprite = active
  224.   if not voidP(pSelected) then
  225.     tell the stage to set the sourceRelToSprite of pSelected = pRelToSprite
  226.   end if
  227. end
  228.  
  229.  
  230. on resetProperties me
  231.   if not voidP(pSelected) then
  232.     tell the stage
  233.       set the drawMethod of pSelected = pOriginalDrawMethod
  234.       set the sourceRelToSprite of pSelected = pOriginalRelToSprite
  235.       if pOriginalSource <> 0 then set the sourceMember of pSelected = pOriginalSource
  236.       set the sourcePosition of pSelected = pOriginalSourcePosition
  237.     end tell
  238.   end if 
  239. end
  240.  
  241. on setMemberEffects me
  242.   if count(pSelectedList) < 1 then exit
  243.   clearTests(me)
  244.   tell the stage
  245.     repeat with m in pSelectedList
  246.       RemoveAllEffects(m)
  247.       repeat with i = 1 to count(pNewEffects)
  248.         put getPropAt(pNewEffects,i) into effect
  249.         put getAt(pNewEffects,i) into args
  250.         AddEffect(m,effect,args)
  251.       end repeat
  252.     end repeat
  253.   end tell
  254. end
  255.  
  256. on testStageMember me, obj
  257.   if not pUpdateStage then exit
  258.   if voidP(pSelected) then exit
  259.   tell the stage
  260.     TestEffect(pSelected, the pEffect of obj, makePropertyList(obj))
  261.   end tell
  262. end
  263.  
  264. on tempStageMember me, obj, effect, args
  265.   setAProp(pNewEffects, effect, makePropertyList(obj))
  266.   if not pUpdateStage then exit
  267.   if voidP(pSelected) then exit
  268.   tell the stage
  269.     TestEffect(pSelected, effect, args)
  270.     updateStage
  271.   end tell
  272. end
  273.  
  274. on updateEffects me, obj
  275.   --testStageMember(me,obj)
  276.   setAProp(pNewEffects, the pEffect of obj, makePropertyList(obj))
  277. end
  278.  
  279. on lingoToClipboard me, obj
  280.   put string(the pEffect of obj) into effect
  281.   put effect&"(sprite yourSprite,"&&makePropertyList(obj) into text
  282.   put text
  283.   put text into field "Lingo To Clipboard"
  284.   copyToClipboard member "Lingo To Clipboard"
  285. end
  286.  
  287. on clearTests me
  288.   if voidP(pSelected) then exit
  289.   tell the stage to EndAllTests(pSelected)
  290. end
  291.  
  292. on getSourceNameAndCast me
  293.   tell the stage
  294.     set pSource =  the sourceMember of pSelected
  295.     set pOriginalSource =  the sourceMember of pSelected
  296.     set pSourcePosition =  the sourcePosition of pSelected
  297.     set pOriginalSourcePosition =  the sourcePosition of pSelected
  298.     set pAlphaOnly = the alphaOnly of pSelected
  299.     set pRelToSprite = the sourceRelToSprite of pSelected
  300.     set pOriginalRelToSprite = the sourceRelToSprite of pSelected
  301.     
  302.     if voidP(pSource) or pSource = 0 then
  303.       set pSource = VOID
  304.       set pSourceMember = ""
  305.       set pSourceCast = ""
  306.     else
  307.       set pSourceMember = the name of pSource
  308.       set pSourceCast = the name of castLib the castLibNum of pSource
  309.     end if
  310.   end tell
  311. end
  312.  
  313.  
  314. on validMember me
  315.   return not voidP(pSelected)
  316. end
  317.  
  318. on setSourceMember me, pSource0
  319.   set pSource = pSource0
  320.   if not voidP(pSelected) then
  321.     tell the stage
  322.       set pSourceMember = the name of pSource
  323.       set pSourceCast = the name of castLib the castLibNum of pSource
  324.       set the sourceMember of member pSelected = pSource
  325.     end tell
  326.   end if
  327. end
  328.  
  329. on newSourcePosition me, pos
  330.   set pSourcePosition = pos
  331.   if not voidP(pSelected) then
  332.     tell the stage
  333.       set the sourcePosition of pSelected = pos
  334.     end tell
  335.   end if
  336. end
  337.  
  338. on setSourceCast me, pSourceCast0
  339.   set pSourceCast = pSourceCast0
  340.   
  341.   set pSource = VOID
  342.   set pSouceMember = ""
  343.   tell the stage
  344.     repeat with c = 1 to the number of members of castLib pSourceCast
  345.       if the type of member c of castLib pSourceCast = #bitmap then
  346.         set pSource = member c of castLib pSourceCast
  347.         set pSourceMember = the name of pSource
  348.         set the sourceMember of member pSelected = pSource
  349.         exit
  350.       end if
  351.     end repeat
  352.   end tell
  353. end
  354.  
  355. -- CALLBACKS
  356.  
  357. on CheckBox me, refCon, status
  358.   set pUpdateStage = status
  359. end
  360.  
  361. -- Add Effect
  362.  
  363. on popupAddEffect me, sNum
  364.   global fxDisplayMember, fxWindow
  365.   
  366.   set where = point(the right of sprite sNum, the top of sprite sNum)
  367.   
  368.   set choice = PopUpMenu(fxDisplayMember, where, pAllEffectsList)
  369.   if (choice > 0) then
  370.     put GetAt(pAllEffectsList, choice) into effect
  371.     goToEffect(me,effect)
  372.   end if
  373. end
  374.  
  375. on setMemory me, n
  376.   put [#effects: pNewEffects] into fx
  377.   addProp fx, #drawMethod, pDrawMethod
  378.   addProp fx, #sourceMember, pSource
  379.   addProp fx, #sourcePosition, pSourcePosition
  380.   set text = GetPref("AlphaMania FX Memory")
  381.   if voidP(text) then put "" into text
  382.   put string(fx) into line n of text
  383.   SetPref("AlphaMania FX Memory",text)
  384.   beep(1)
  385. end
  386.  
  387. on getMemory me, n
  388.   set text = GetPref("AlphaMania FX Memory")
  389.   if voidP(text) then put "" into text
  390.   put value(line n of text) into fx
  391.   if listP(fx) then
  392.     if count(fx) > 3 then
  393.       setDrawMethod(me,getProp(fx,#drawMethod))
  394.       setSourceMember(me,getProp(fx,#sourceMember))
  395.       newSourcePosition(me,getProp(fx,#sourcePosition))
  396.       set pNewEffects = getProp(fx,#effects)
  397.       updateFXtextlist(me)
  398.       go to frame "General Member Settings"
  399.       beep(2)
  400.     end if
  401.   end if
  402. end
  403.  
  404. on Release
  405.   set released = true
  406. end
  407.  
  408.  
  409.